﻿#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>

bool isleap(int year) {
    return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}

int week_of_firstday(int year) {
    int n = year - 1900;
    n = n + (n - 1) / 4 + 1;
    return (n % 7 + 6) % 7;  // 0=周一
}

int len_of_month(int year, int month) {
    if (month == 4 || month == 6 || month == 9 || month == 11)
        return 30;
    else if (month == 2)
        return isleap(year) ? 29 : 28;
    else
        return 31;
}

int main()
{
    printf("请输入年和月");
    int year, month;
    int day = len_of_month(year, month);
    scanf("%d %d", &year, &month);
    printf("====================\n");
    printf("     %d年%d月\n",year,month);
    printf("====================\n");
    printf("一 二 三 四 五 六 日\n");
    int count=0;
    for (int i = 0; i < day; i++,count++)
    {
        printf("%d", i);
        if (count == 7)
        {
            printf("\n");
            count = 0;
        }
   }
    return 0;
}